//
//  MineCell.m
//  Btpin
//
//  Created by Vic on 2019/3/17.
//  Copyright © 2019 Vic. All rights reserved.
//

#import "MineCell.h"

@interface MineCell ()
{
    UIImageView *iconImgView;
    UILabel *leftLbl;
    UILabel *rightLbl;
}
@end

@implementation MineCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self initUI];
    }
    return self;
}
- (void)initUI {
    iconImgView = [UIToolsControl initImageViewWithFrame:CGRectMake(10, 10, 10, 10) imageName:nil];
    iconImgView.userInteractionEnabled = NO;
    [self.contentView addSubview:iconImgView];
    
    leftLbl = [UIToolsControl initLabelWithFrame:CGRectMake(55*Scale, 0, 200, self.frame.size.height) text:nil textColor:THEMECOLOR_OF_TEXT_333333 font:Font_15];
    [self.contentView addSubview:leftLbl];
    
    rightLbl = [UIToolsControl initLabelWithFrame:CGRectMake(0, 0, WIDTH-39*Scale, self.frame.size.height) text:nil textColor:THEMECOLOR_OF_TEXT_9a9a9a font:Font_13];
    rightLbl.textAlignment = NSTextAlignmentRight;
    [self.contentView addSubview:rightLbl];
    
    UIView *lineView = [UIToolsControl initViewWithFrame:CGRectMake(0, 50*Scale-lineH, WIDTH, lineH) backgroundColor:THEMECOLOR_OF_TEXT_cccccc];
    [self.contentView addSubview:lineView];
}
- (void)reloadDataIcon:(NSString *)icon leftText:(NSString *)leftText rightText:(NSString *)rightText indexPath:(nonnull NSIndexPath *)indexPath {
    UIImage *img = [UIImage imageNamed:icon];
    iconImgView.frame = CGRectMake(10, 0, img.size.width, img.size.height);
    CGFloat centerX = 31*Scale;
    CGFloat centerY = self.frame.size.height*0.5;
    iconImgView.center = CGPointMake(centerX, centerY);
    
    iconImgView.image = img;
    leftLbl.text = leftText;
    rightLbl.text = rightText;
    
    rightLbl.textColor = THEMECOLOR_OF_TEXT_9a9a9a;
    if ([UD_GetOForK(isUserRole) isEqualToString:@"2"]) { // 求职
        if ((indexPath.section == 0) && (indexPath.row == 4)) {
            rightLbl.textColor = THEMECOLOR_OF_ORANGE;
        }
    } else { // 企业
        if ((indexPath.section == 0) && (indexPath.row == 1)) {
            if (![rightText isEqualToString:@"已认证"]) {
                rightLbl.textColor = THEMECOLOR_OF_RED;
            }
        }
    }
}

- (void)awakeFromNib {
    [super awakeFromNib];
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
}

@end
